//模块配置信息
require.config({
	//baseUrl: "./",
	paths: {
		//工具模块
		'less': 'tools/less.min',
		'jquery': 'tools/jquery.min',
		'bootstrap': 'tools/bootstrap.min',
		'handlebars': 'tools/handlebars',

		//配置模块
		'config': './config',
		"appConfig":"./appConfig",

		'top_bar': 'modules/top_bar',
		'problem': 'modules/problem',
		'showBigImg': 'modules/showBigImg',
		'userInfo': 'modules/userInfo',
		'ask': 'modules/ask',
		'modal_template': 'modules/modal_template',
		'cookie': 'modules/cookie',
		'check_log': 'modules/check_log',
		'login': 'modules/login',
		'other_log': 'modules/login',
		'reg': 'modules/reg',
		'user': 'modules/user',
	},
	skim: {  //配置依赖关系与接口
		"bootstrap": {	// bootstrap依赖jquery库
			deps: ['jquery'],
			exports: 'bootstrap'
		},
		"handlebars": {
			exports: 'Handlebars'
		},
		"user": {
			deps: ['modal_template']
		}
	}
});


//加载LESS, jquery, bootstrap
require(['less', 'jquery'], function(){
	require(['bootstrap']);	
});

//加载顶栏top_bar模块
require(['top_bar'], function(top_bar){
	top_bar();
});

//加载中心问题模块，并用Hanlebars生成
require(['problem', 'cookie'], function(problem, cookie){
	var userId = cookie.getCookie('userId');
	var url = window.location.href;
	var reg = /problemId=[\s|\S]+$/;
	if (reg.test(url)){
		var problemId = reg.exec(url)[0];
		problemId = problemId.split('=')[1];

		problem.getProblemById(userId, problemId);
		problem.clickZan();
		problem.clickAnswer_Comment();
		problem.newAnswer();
		problem.replyAnswer();
		problem.newComment();
		problem.replyComment();
	}

});

//右方个人信息模块
require(['userInfo'], function(userInfo){
	userInfo.hasAvatar();
});